home *** CD-ROM | disk | FTP | other *** search
/ Developer Source 7 / developer source - volume 7.iso / msysj / aug96 / dilaf105.gif < prev    next >
Graphics Interchange Format  |  1997-01-16  |  52KB  |  283x502  |  4-bit (16 colors)
Labels: text | electronics | screenshot | font | number
OCR: Step 1: Initial assignment cstr1 = "Hollo world"; CString 11 30 Hello wond\O .. CString allocates space for "Hello world" and fills CStringData with length and ref count = 1. Step 2: Copy estr2 = cstr1; CString dstri Hello world \ 0 ... CString estir cstr2 points to same object as estri. No allocation required, Just Increment the ref count .. Stop 3: Modify cstr2 = "Goodbye"; CString Hello world \ O .. CString ostr2 Goodbye \ O ... When estr2 is modified, a new memory object is allocated and the data copied from cstri to ostr2 before the modification is made. Ref count for estri Is decremented; ref count for cstr2 set to 1. Figure 5 CString Copy on Modify in Action!